import requests from "./requests.js";
import mockrequest from "./mockrequest.js";

export const reqCategory = () => {
  return requests.get("/product/getBaseCategoryList");
};
export const reqBanner = () => {
  return mockrequest.get("/banner");
};

export const reqFloor = () => {
  return mockrequest.get("/floor");
};
export const reqSearch = (data) => {
  return requests.post("/list", data);
};
export const reqDetail = (skuId) => {
  return requests.get(`/item/${skuId}`);
};
export const reqAddcart = ({ skuId, skuNum }) => {
  return requests.post(`/cart/addToCart/${skuId}/${skuNum}`);
};
export const reqCartList = () => {
  return requests.get("/cart/cartList");
};
export const reqRemoveSku = (skuId) => {
  return requests.delete(`/cart/deleteCart/${skuId}`);
};
export const reqchangeChecked = ({ skuId, isChecked }) => {
  return requests.get(`/cart/checkCart/${skuId}/${isChecked}`);
};
export const reqGetCode = (phone) => {
  return requests.get(`/user/passport/sendCode/${phone}`);
};
export const reqRegister = (data) => {
  return requests.post("/user/passport/register", data);
};
export const reqGetLogin = (data) => {
  return requests.post("/user/passport/login", data);
};
export const reqGetUserValue = () => {
  return requests.get("/user/passport/auth/getUserInfo");
};
export const reqLogOut = () => {
  return requests.get("/user/passport/logout");
};
export const reqTrade = () => {
  return requests.get("/order/auth/trade");
};
export const reqSumit = (tradeNo, data) => {
  return requests.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, data);
};
export const reqPayInfo = (orderId) => {
  return requests.get(`/payment/weixin/createNative/${orderId}`);
};
export const reqPaySuccess = (orderId) => {
  return requests.get(`/payment/weixin/queryPayStatus/${orderId}`);
};
export const reqOrder = (page, limit) => {
  return requests.get(`/order/auth/${page}/${limit}`);
};
